Syntax of Command Strings

MCI command strings use a consistent verb-object-modifier syntax. Each command string includes a command, a device identifier, and command arguments. Arguments are optional for some commands and required for others.

A command string has the following form:

command device_id arguments

These components contain the following information:

    The command specifies an MCI command, such as open1GMTS1P, close4BA_J1, or playUDIOAK.

    The device_id identifies an instance of an MCI driver. The device_id is created when the device is opened.

    The arguments specify the flags and variables used by the command. Flags are keywords recognized with the MCI command. Variables are numbers or strings that apply to the MCI command or flag.

For example, the play command uses the arguments  from position  and  to position  to indicate the positions at which to start and end play. You can list the flags used with a command in any order. When you use a flag that has a variable associated with it, you must supply a value for the variable.

Unspecified (and optional) command arguments assume a default value.

 

The following example function sends the playUDIOAK command with the  from  and  to  flags.

DWORD PlayFromTo(LPSTR lpstrAlias, DWORD dwFrom, DWORD dwTo)

    char achCommandBuff[128];

 

    // Form the command string.

    wsprintf(achCommandBuff, "play %s from %u to %u",

        lpstrAlias, dwFrom, dwTo);

 

    // Send the command string.

    return mciSendString(achCommandBuff, NULL, 0, NULL);

}